<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="/WEB-INF/tags/functions.tld" %>
<%@ taglib prefix="t" uri="/WEB-INF/tags/tags.tld" %>
<link rel="stylesheet" href="/css/table.css" type="text/css" media="all" />
<link rel="stylesheet" href="/css/paging.css" type="text/css" media="all" />
<link rel="stylesheet" href="/css/message.css" type="text/css" media="all" />
<script type="text/javascript" src="/js/functions.js"></script>
<script type="text/javascript" src="/js/notify.js"></script>
<link rel="stylesheet" href="/css/jquery.ui.theme.css">
<link rel="stylesheet" href="/css/jquery.ui.core.css" />
<link rel="stylesheet" href="/css/jquery.ui.autocomplete.css" />
<link rel="stylesheet" href="/css/jquery.ui.menu.css" />
<script src="/js/jquery.ui.core.js"></script>
<script src="/js/jquery.ui.widget.js"></script>
<script src="/js/jquery.ui.position.js"></script>
<script src="/js/jquery.ui.menu.js"></script>
<script src="/js/jquery.ui.autocomplete.js"></script>
<script type="text/javascript" src="/js/searchClassAC.js"></script>

<h2 style="margin-left: 2%;">Tìm kiếm lớp học được mở</h2>
<hr size="1" />

<div class="box">
	<h3 class="boxTitle">Tìm kiếm lớp học</h3>
	<form action="/student/searchOpenedClasses.html" method="GET">
		<table style="width: 100%">
			<tr>
				<td>Mã lớp</td>
				<td><input type="text" name="cId" id="cId" class="searchInput" value="${param.cId}" /></td>
				<td>Học phần</td>
				<td><input type="text" name="sId" id="sId" class="searchInput" value="${param.sId}" /></td>
			</tr>
			<tr>
				<td colspan="4"><input type="submit" value="Tìm kiếm" /></td>
			</tr>
		</table>
	</form>
</div>

<c:if test="${classes == null or empty classes}">
	<b>Không có lớp học nào được tìm thấy</b>
</c:if>
<c:if test="${classes != null and !empty classes}">
	<table>
		<thead>
			<tr>
				<th class="th">STT</th>
				<th class="th">Mã lớp</th>	
				<th class="th">Tên lớp</th>
				<th class="th">Học phần</th>
				<th class="th">Giảng viên</th>	
			</tr>	
		</thead>
		<tbody>
		<c:forEach items="${classes}" var="c" varStatus="status">
			<tr>
				<td class="td"><c:out value="${(pageInfo.currentPage - 1) * pageSize + status.count}" escapeXml="true" /></td>
				<td class="td"><c:out value="${c.classId}" escapeXml="true" /></td>
				<td class="td"><c:out value="${c.className}" escapeXml="true" /></td>
				<td class="td"><c:out value="${c.subject.subjectId}" escapeXml="true" /></td>
				<td class="td"><c:out value="${c.lecturer.lecturerName}" escapeXml="true" /></td>
			</tr>
		</c:forEach>
		</tbody>
		<tfoot>
			<tr>
				<td colspan="5">
					<div class="pages">
						<t:paging pageInfo="${pageInfo}" link="/student/searchOpenedClasses.html" params="${params}"/>
					</div>
				</td>
			</tr>
		</tfoot>
	</table>
</c:if>